package com.sam.service.impl;

import com.sam.domain.entity.SysPerms;
import com.sam.domain.entity.SysUser;
import com.sam.domain.entity.SysUserRole;
import com.sam.mapper.SysPermsMapper;
import com.sam.mapper.SysUserMapper;
import com.sam.mapper.SysUserRoleMapper;
import com.sam.service.ISysUserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 查询用户
 *
 * @author sam
 * @since 2025-03-01 11:43
 */
@Service
public class SysUserServiceImpl implements ISysUserService {

    @Resource
    protected SysUserMapper sysUserMapper;

    @Resource
    protected SysUserRoleMapper sysUserRoleMapper;

    @Resource
    protected SysPermsMapper sysPermsMapper;

    @Override
    public SysUser selectUserByName(String userName) {
        return sysUserMapper.selectUserByName(userName);
    }

    @Override
    public List<SysUserRole> selectUserRoleByUserId(Long userId) {
        return sysUserRoleMapper.selectUserRoleByUserId(userId);
    }

    @Override
    public List<SysPerms> selectRolePermsByUserId(Long userId) {
        return sysPermsMapper.selectRolePermsByUserId(userId);
    }
}
